export default class gameOverUI_2 extends Laya.Script {
    
    constructor() { super(); }
    private rank_btn:Laya.Button
    private select_btn:Laya.Button
    private back_btn:Laya.Button
    
    onEnable(): void {
        //初始化变量
       this.initParams()
       //初始化绑定事件
       this.initEvent()
    }

    initEvent(){ 
        //给选择关卡按钮绑定事件
        this.rank_btn.on(Laya.Event.CLICK,this,this.onRank)
        //给选择关卡按钮绑定事件
        this.select_btn.on(Laya.Event.CLICK,this,this.onSelectGame)
        //给选择关卡按钮绑定事件
        this.back_btn.on(Laya.Event.CLICK,this,this.onBackGame)
    }

    onRank(){
        //跳转到排行榜界面场景
        Laya.Scene.open("rank_scene.scene")
    }
    onSelectGame(){
        //跳转到选择关卡场景
        Laya.Scene.open("select_scene.scene")
    }
    onBackGame(){
        //重新开始游戏
        Laya.Scene.open("gameScene2.scene")
    }

    initParams(){
        //获取开始按钮节点
        this.select_btn=this.owner.getChildByName('select')as Laya.Button
        //获取排行榜按钮节点
        this.rank_btn=this.owner.getChildByName('rank')as Laya.Button
        //获取重新开始按钮节点
         this.back_btn=this.owner.getChildByName('back')as Laya.Button
    }

    onDisable(): void {
    }
}